package work1;

public class Circle extends Graph{
    private double r;

    public Circle() {}

    public Circle(double r) {
        this.r = r;
    }
    public Circle(double r,String color,boolean fill){
        super(color,fill);
        this.r = r;
    }

    public double getR() {
        return r;
    }

    public void setR(double r) {
        this.r = r;
    }

    @Override
    double getArea() {
        return Math.PI*r*r;
    }

    @Override
    double getPrimeter() {
        return 2*Math.PI*r;
    }

    @Override
    public String toString() {
        return "圆的半径为:" + r + ",圆的颜色为:" + color + ",是否填充颜色:" + (fill? "是":"否") + ",圆的面积为:" + getArea() + ",圆的周长为:" + getPrimeter();
    }
}
